Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

331
Views
How can I find who deleted the role on "roleDeltete" in discord.js

I'm on v13 of discord.js and when I run this client.on('roleDelete', a => { console.log(a); }); it only logs deleted: true don't show who deleted. Can somebody help me about how can I find who deleted the role on "roleDelete" event ?

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use audit logs. The bot will need permissions though:

client.on("roleDelete", async role => {
  let member;
  try {
    const log = await role.guild.fetchAuditLogs({ 
      type: "ROLE_DELETE"
    })
    member = role.guild.members.resolve(log.entries.first().executor)
  } catch (err) {
    console.log(err) // simply for debugging
  }
  if (!member) member = null
})

And now when you access member, it will show null if it couldn't find the executor, but will show the GuildMember who deleted the role if they were found.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!